package com.servlet.web;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Title: HelloServlet02
 * @Description:
 * @Auther: py
 * @Version: 1.0
 * @create 2023/12/21 11:35
 */
// @WebServlet(urlPatterns = "/hello01")
@WebServlet(value = "/hello01",loadOnStartup=2)
public class HelloServlet02 extends HttpServlet {

    public HelloServlet02() {
        System.out.println("HelloServlet02.......");
    }

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        resp.getWriter().write("hello servlet get!");
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        resp.getWriter().write("hello servlet post!");
    }
}
